﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NormalCoinBehaviour : MonoBehaviour
{
    public int destroyDelay = 5;
    // Start is called before the first frame update
    void Start()
    {
        Player.Instance.onBodyCollisionEnter.AddListener(collider =>
        {
            if (collider.CompareTag("Normal Coin"))
            {
                Global.money += 100;
                collider.transform.parent.GetComponentInChildren<ParticleSystem>().Play();
                Destroy(collider.transform.parent.gameObject, destroyDelay);
                Destroy(collider.gameObject);
            }
        });
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
